import requests from './request.js'
import utils from './utils.js'
import apiPath from './apiPath.js'

//接口方法
async function code(status, res, isShow) {
	//console.log(JSON.stringify(res,null,2))
	if (isShow) {
		uni.hideLoading();
	}
	if (status == 200001) {
		return res.data;
	} else if (status == 401001 || status == 400200) {
		if (!uni.getStorageSync("isLogin")) {
			utils.showTips("请先登录账号")
			utils.isgologin()
			uni.setStorageSync("isLogin", 1)
		}
	} else if (status == 810402 || status == 10001 || status == 100401) {
		utils.showTips(res.data.message)
	} else {
		return res.data;
	}
}
async function showLoading(isShow) {
	if (isShow) {
		uni.showLoading({
			title: '加载中',
			mask: true
		});
	}
}
// 登陆
async function login(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/auth-login', 'POST', options));
	console.log("登录成功", res)
	if (res.data.code == 200001) {
		uni.removeStorage("isLogin")
	}
	return code(res.data.code, res, isShow)
}
// 获取手机号
async function getphone(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/auth-phone', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function get_merchants(options, id, isShow) { //获取商家信息
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/merchants/' + id, 'GET', options));
	return code(res.data.code, res, isShow)
}
// 商家入驻
async function SettleIn(options, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/merchant-settled', 'POST', options));
	return code(res.data.code, res, isShow)
}
// 商家入驻协议
async function text(options, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/settled-agreement', 'GET', options));
	return code(res.data.code, res, isShow)
}
//上传图片
async function upImage(path) {
	return new Promise((resolve, reject) => {
		// 开始上传（异步）
		uni.uploadFile({
			url: 'https://guizhouchenxun.com/api/public/images/upload',
			filePath: path,
			name: 'file',
			success: (res) => {
				if (res.statusCode == 200) {
					let data = JSON.parse(res.data);
					resolve(data.data)
				}
			}
		})
	});
}
//上传图片
async function upImageList(path) {
	var returnList = []
	return new Promise((resolve, reject) => {
		// 循环数组上传若干个图片地址
		for (let i = 0; i < path.length; i++) {
			// 开始上传（异步）
			uni.uploadFile({
				url: 'https://guizhouchenxun.com/api/public/images/upload',
				filePath: path[i],
				name: 'image',
				success: (res) => {
					if (res.statusCode == 200) {
						let data = JSON.parse(res.data);
						returnList.push(data.data)
					}
					if (path.length == returnList.length) {
						resolve(returnList)
					}
				}
			})
		}
	});
}
// index轮播图merchant-cate
async function index(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/index-banners', 'GET', options));
	return code(res.data.code, res, isShow)
}
//首页 经营分类
async function index_9(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/merchant-categories', 'GET', options));
	return code(res.data.code, res, isShow)
}
// 二级经营分类
async function getTwoClassListApi(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`public/merchants/${id}/second-categories`, 'GET', options));
	return code(res.data.code, res, isShow)
}
// 获取二级分类列表
async function getTwoClassGoodsListApi(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`public/merchants/second-categories/list`, 'GET', options));
	return code(res.data.code, res, isShow)
}

// 用户详情
async function user(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/details', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function money(options, id, isShow) { //获取商家入驻费用
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/merchants/settled-fees', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function money_order(options, id, isShow) { //商家入驻创建订单
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/settled-create', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function money_order_pay(options, id, isShow) { //商家入驻 支付订单
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/settled-pay/' + id, 'POST', options));
	return code(res.data.code, res, isShow)
}
async function money_order_notify(options, id, isShow) { //商家入驻 支付回调订单
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/settled-notify/' + id, 'POST', options));
	return code(res.data.code, res, isShow)
}
async function policy(options, id, isShow) { //隐私政策
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/privacy-policy', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function agreement(options, id, isShow) { //用户协议
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/user-agreement', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function agency(options, id, isShow) { //代理协议
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/agency-agreement', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function messages(options, id, isShow) { //系统消息
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/system-messages', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function unread_count(options, id, isShow) { //系统消息未读数量
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/system-messages/unread-count', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function messages_details(options, id, isShow) { //系统消息详情
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/system-messages/' + id + '/details', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function addresses(options, id, isShow) { //添加收货地址
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/addresses/add', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function addresses_list(options, id, isShow) { //地址列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/addresses', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function defaultAddress(options, id, isShow) { //修改默认地址
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/default-address/' + id + '/set', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function Address_change(options, id, isShow) { //编辑地址
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/addresses/' + id + '/change', 'POST', options));
	return code(res.data.code, res, isShow)
}

async function Address_delete(options, id, isShow) { //删除地址
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/addresses/' + id + '/delete', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function nearest_address(options, id, isShow) { //最近地址
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/nearest-address/' + id, 'GET', options));
	return code(res.data.code, res, isShow)
}
async function avatar(options, id, isShow) { //修改用户头像
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/change-avatar', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function nickname(options, id, isShow) { //修改用户头像
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/change-nickname', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function vip_benefits(options, id, isShow) { //会员权益
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/vip-benefits', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function vipfees(options, id, isShow) { //会员年费
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/vip-fees', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function vip_fees_cj(options, id, isShow) { //会员年费订单创建
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/vip-create', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function vip_fees_pay(options, id, isShow) { //会员年费订单支付
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/vip-pay/' + id, 'POST', options));
	return code(res.data.code, res, isShow)
}
async function vip_fees_hd(options, id, isShow) { //会员年费订单支付回调
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/vip-notify/' + id, 'POST', options));
	return code(res.data.code, res, isShow)
}
//主营分类
async function merchants_type(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/merchant-mains', 'GET', options));
	return code(res.data.code, res, isShow)
}
// 主营下经营分类
async function merchants_class(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`public/merchants/${id}/categories`, 'GET', options));
	return code(res.data.code, res, isShow)
}
// 商家二级分类列表
async function merchants_class2(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`public/merchants/${id}/second-categories`, 'GET', options));
	return code(res.data.code, res, isShow)
}


async function merchants_info(options, id, isShow) { //用户自己商家信息
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/merchants', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function types(options, id, isShow) { //信息发布类型
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/city-information/types', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function TC_news(options, id, isShow) { //同城信息
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/city-information', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function TC_news_detail(options, id, isShow) { //同城信息详情
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/city-information/' + id + '/details', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function my_city_information(options, id, isShow) { //我的信息发布
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/my-city-information', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function my_city_information_dalete(options, id, isShow) { //我的信息删除
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/my-city-information/' + id + '/delete', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function city_information_release(options, isShow) { //信息发布
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/city-information/release', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function point_rule(options, id, isShow) { //积分规则
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/point-rule', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function point_details(options, id, isShow) { //积分明细
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/point-details', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function tab_goods_categories(options, id, isShow) { //经营分类商品（大分类）
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('goods/goods-categories/' + id, 'GET', options));
	return code(res.data.code, res, isShow)
}
async function mains_list(options, id, isShow) { //商家列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/merchant-mains/' + id + '/list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function goods_list(options, id, isShow) { //商家商品列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/merchants/' + id + '/goods-list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function goods_list_details(options, id, isShow) { //商品详情
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('goods/' + id + '/details', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function ADD_cart(options, id, isShow) { //加入购物车
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('carts/goods/' + id + '/add', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function cart_list(options, id, isShow) { //购物车列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('carts/merchants/' + id, 'GET', options));
	return code(res.data.code, res, isShow)
}
async function cart_delete(options, id, isShow) { //购物车删除
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('carts/' + id + '/delete', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function service_phone(options, id, isShow) { //平台客服
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/platform-customer-service', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function cart_orders(options, id, isShow) { //购物车订单创建
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/merchants/' + id + '/cart-create', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function cart_orders_pay(options, id, isShow) { //购物车订单支付
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/merchant-pay/' + id, 'POST', options));
	return code(res.data.code, res, isShow)
}
async function cart_orders_notify(options, id, isShow) { //购物车订单支付回调
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/merchant-notify/' + id, 'POST', options));
	return code(res.data.code, res, isShow)
}
async function recommend_good(options, id, isShow) { //商品推荐
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('goods/recommend', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function default_address(options, id, isShow) { //默认地址
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/default-address', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function self_pick_list(options, id, isShow) { //自提订单列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/self-pick-orders/list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function self_pick_list_details(options, id, isShow) { //自提订单详情
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/merchants/self-pick/' + id + '/details', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function self_pick_cancel(options, id, isShow) { //自提订单详情
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/merchants/self-pick/' + id + '/cancel', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function order_comment(options, id, isShow) { //订单评价
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/orders/' + id + '/comment', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function express_order_list(options, id, isShow) { //物流订单列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/merchants/express-delivery-list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function express_order_delivery(options, id, isShow) { //物流订单详情
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/orders/' + id + '/details', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function express_order_cancel(options, id, isShow) { //取消物流订单
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/merchants/express-delivery/' + id + '/cancel', 'GET',
		options));
	return code(res.data.code, res, isShow)
}
async function express_order_change_address(options, id, add_id, isShow) { //修改物流配送收货地址
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/merchants/express-delivery/' + id + '/change-address/' +
		add_id, 'POST', options));
	return code(res.data.code, res, isShow)
}
async function spec_example(options, id, add_id, isShow) { //规格实例
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/spec-example', 'GET', options));
	return code(res.data.code, res, isShow)
}

async function user_bank(options, id, isShow) { //银行卡列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/banks', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function user_withdraw(options, id, isShow) { //用户提现
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/withdraw', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function user_add_bank(options, id, isShow) { //用户添加银行卡
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/banks/add', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function become_agent(options, id, isShow) { //成为代理
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/become-agent', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function commission_records(options, id, isShow) { //收益记录（用户）
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/commission-records/list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function orders_merchants(options, id, isShow) { //订单创建（直接购买）
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/merchants/' + id + '/create', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function users_orders_confirm(options, id, isShow) { //确认收货
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/orders/' + id + '/confirm', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function refund_types(options, id, isShow) { //退款可选类型
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/refund-types/' + id, 'GET', options));
	return code(res.data.code, res, isShow)
}
async function orders_refund(options, id, isShow) { //退款提交
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/orders/' + id + '/refund', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function comments_list(options, id, isShow) { //评价列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('goods/' + id + '/comments/list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function cancel_refund(options, id, isShow) { //取消申请退款
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/orders/' + id + '/cancel-refund', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function users_delivery_orders_list(options, id, isShow) { //商家配送订单列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/delivery-orders/list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function merchant_pay(options, id, isShow) { //商家订单支付
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/merchant-pay/' + id, 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchant_pay_notify(options, id, isShow) { //商家订单支付回调
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/merchant-notify/' + id, 'POST', options));
	return code(res.data.code, res, isShow)
}
async function meal_orders_list(options, id, isShow) { //点餐订单列表(用户端)
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/meal-orders/list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function tables_num(options, id, isShow) { //获取桌号
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/tables/' + id + '/infos', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function user_goods_categories(options, id, isShow) { //用户获取商家商品分类
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/merchants/' + id + '/goods-categories', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function user_goods_categories_list(options, id, isShow) { //用户获取商家商品分类 列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('goods/goods-categories/' + id, 'GET', options));
	return code(res.data.code, res, isShow)
}
async function merchants_search(options, id, text, isShow) { //搜索店内商品
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('goods/merchants/' + id + '/search/' + text, 'GET', options));
	return code(res.data.code, res, isShow)
}
async function user_search(options, text, isShow) { //搜索店内商品
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('goods/search/' + text, 'GET', options));
	return code(res.data.code, res, isShow)
}
async function users_commission_records(options, isShow) { //收益记录
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/commission-records/list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function commission_infos(options, isShow) { //收益信息
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/commission-infos', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function teams(options, isShow) { //我的团队
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/teams/list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function change_phone(options, isShow) { //修改手机号
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/change-phone', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function getcode(options, php, isShow) { //获取验证码
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/phone-code/' + php + '/send', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function logoff(options, php, isShow) { //注销
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/logoff', 'POST', options));
	return code(res.data.code, res, isShow)
}



/* 
上线 
 */
async function online(options, id, isShow) { //
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('im/online', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function send(options, id, isShow) { //发送信息
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('im/send', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function user_unread(options, id, isShow) { //用户未读信息
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('im/user-messages/unread', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function messages_unread(options, id, isShow) { //商家未读信息
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('im/mch-messages/unread', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function is_online(options, id, isShow) { //是否在线
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('im/is-online', 'GET', options));
	return code(res.data.code, res, isShow)
}
/* 
上线 
 */

async function userBaseInfo(options, id, isShow) { //用户简略信息
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/users/' + id + '/simple', 'GET', options));
	return code(res.data.code, res, isShow)
}

// 订单未完成
async function unfinished1(options, id, isShow) { //物流订单未完成数量
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/express-orders/not-completed-number', 'GET', options));
	return code(res.data.code, res, isShow)
}

async function unfinished2(options, id, isShow) { //配送订单未完成数量
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/delivery-orders/not-completed-number', 'GET', options));
	return code(res.data.code, res, isShow)
}

async function unfinished3(options, id, isShow) { //自提订单未完成数量
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/self-pick-orders/not-completed-number', 'GET', options));
	return code(res.data.code, res, isShow)
}

async function unfinished4(options, id, isShow) { //点餐订单未完成数量
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/meal-orders/not-completed-number', 'GET', options));
	return code(res.data.code, res, isShow)
}

// 订单未完成











/* 
 商家端接口
 */


// 商家基本信息
async function merchant(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/infos', 'GET', options));
	return code(res.data.code, res, isShow)
}
//修改商家信息
async function merchant_avater(options, id, isShow) { //修改头像
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/change-avatar', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchant_cover(options, id, isShow) { //修改头像
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/change-shop-cover', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchant_address(options, id, isShow) { //修改地址&详细地址
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/change-shop-address', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchant_person(options, id, isShow) { //修改联系人
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/change-contact-person', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchant_phone(options, id, isShow) { //修改联系方式
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/change-contact-phone', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchant_intro(options, id, isShow) { //修改店简介
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/change-shop-intro', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchant_name(options, id, isShow) { //修改店名
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/change-shop-name', 'POST', options));
	return code(res.data.code, res, isShow)
}
//修改商家信息
//商家添加商品分类
async function merchant_cate_add(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/goods-categories/create', 'POST', options));
	return code(res.data.code, res, isShow)
}
//商家修改分类
async function merchant_cate_edit(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/merchant/cate_edit', 'POST', options));
	return code(res.data.code, res, isShow)
}
//商家分类删除
async function merchant_cate_delete(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/goods-categories/' + id + '/delete', 'POST', options));
	return code(res.data.code, res, isShow)
}

async function merchant_cate_list(options, id, isShow) { //商家主营分类列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/merchants/' + id + '/categories', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function goods_categories(options, id, isShow) { //商家商品分类列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/goods-categories', 'GET', options));
	return code(res.data.code, res, isShow)
}
//商家消息列表
async function merchant_goods_list(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/merchant/goods_list', 'GET', options));
	return code(res.data.code, res, isShow)
}
//商家删除商品
async function merchant_goods_delete(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/merchant/goods_delete', 'POST', options));
	return code(res.data.code, res, isShow)
}
//商家新建商品
async function merchant_goods_add(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/goods/create', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchant_goods_edit(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/goods/' + id + '/edit', 'POST', options));
	return code(res.data.code, res, isShow)
}
//商家端商品列表
async function merchant_good_list(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/merchant/goods_list', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchant_open(options, id, isShow) { //店铺营业开启
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/open', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchant_close(options, id, isShow) { //店铺营业关闭
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/close', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchant_Time(options, id, isShow) { //店铺营业时间
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/change-business-hours', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function add_bank(options, id, isShow) { //添加银行卡
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/banks/add', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function my_bank(options, id, isShow) { //我的银行卡
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/banks', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function my_bank_delete(options, id, isShow) { //银行卡删除
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/banks/' + id + '/delete', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function withdraw(options, id, isShow) { //商家提现
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/withdraw', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function change_yunfei(options, id, isShow) { //修改运费
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/change-express-fee', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function write_off(options, id, isShow) { //核销订单
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/orders/' + id + '/write-off', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchants_self_pick_details(options, id, isShow) { //商家自提订单详情
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('orders/merchants/self-pick/' + id + '/details', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function merchants_self_pick_list(options, id, isShow) { //商家自提订单列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/self-pick-orders/list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function tables_add(options, id, isShow) { //添加桌号
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/tables/add', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function tables_list(options, id, isShow) { //桌号列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/tables', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function tables_change(options, id, isShow) { //桌号列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/tables/' + id + '/change', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function order_tz(options, id, isShow) { //订单通知
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/order-messages/list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function change_lng_lat(options, id, isShow) { //商家经纬度
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/change-lng-lat', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function express_orders_list(options, id, isShow) { //物流订单列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/express-orders/list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function merchants_meal_orders_list(options, id, isShow) { //点餐订单列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/meal-orders/list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function delivery_orders_list(options, id, isShow) { //配送订单列表
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/delivery-orders/list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function orders_details(options, id, isShow) { //订单详情
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/orders/' + id + '/details', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function merchants_goods_delete(options, id, isShow) { //删除商品
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/goods/' + id + '/delete', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function express_delivery_orders(options, id, isShow) { //填写运单号
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/express-delivery-orders/' + id + '/write', 'POST',
		options));
	return code(res.data.code, res, isShow)
}
async function credit_records(options, id, isShow) { //收益明细
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/credit-records/list', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function efund_orders(options, id, isShow) { //拒绝退款
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/refund-orders/' + id + '/reject', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function efund_orders_agree(options, id, isShow) { //同意退款
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/refund-orders/' + id + '/agree', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function delivery_orders_cancel(options, id, isShow) { //取消配送订单
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/delivery-orders/' + id + '/cancel', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function delivery_orders_take(options, id, isShow) { //接单
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/delivery-orders/' + id + '/take', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function delivery_orders_confirm(options, id, isShow) { //确认送达
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/delivery-orders/' + id + '/confirm', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function meal_orders(options, id, isShow) { //处理点餐订单
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/meal-orders/' + id + '/handle', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function month_transaction_details(options, id, isShow) { //月报
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/month-transaction-details', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function change_shop_printer(options, id, isShow) { //打印设置
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/change-shop-printer', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchants_change_shop_point(options, id, isShow) { //积分开通申请
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/change-shop-point', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchants_order_messages_read(options, id, isShow) { //订单消息已读
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/order-messages/read', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function merchants_order_messages_unread_number(options, id, isShow) { //订单消息已读
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/order-messages/unread-number', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function agentsApply(options, id, isShow) { //申请成为代理
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('agents/apply', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function agentsApplyInfos(options, id, isShow) { //申请成为代理状态
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('agents/apply-infos', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function agentsMerchants(options, id, isShow) { //我的商户
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('agents/merchants', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function usersDirect(options, id, isShow) { //我的邀请人
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/direct', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function merchants_settled_rule(options, id, isShow) { //入驻规则
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/merchants/settled-rule', 'GET', options));
	return code(res.data.code, res, isShow)
}
async function chinaArea(options, id, isShow) { //获取省市区
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/china-area/deeps/' + 1 + ',' + 2 + '/area/' + id, 'GET',
		options));
	return code(res.data.code, res, isShow)
}
async function chinaArea_id(options, id, isShow) { //获取 城市
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('public/china-area/' + id, 'GET', options));
	return code(res.data.code, res, isShow)
}
async function direct_refund(options, id, isShow) { //直接退款
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('users/orders/' + id + '/direct-refund', 'POST', options));
	return code(res.data.code, res, isShow)
}
async function cartsClear(options, id, isShow) { //清空购物车
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('carts/merchants/' + id + '/clear', 'POST', options));
	return code(res.data.code, res, isShow)
}

// 商家端 现金券列表
async function getAVoucherListApi(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/coupons/list', 'get', options));
	return code(res.data.code, res, isShow)
}

// 商家端 创建现金券
async function addAVoucherApi(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/coupons/create', 'post', options));
	return code(res.data.code, res, isShow)
}

// 商家端 修改现金券
async function updateAVoucherApi(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests('merchants/coupons/edit', 'post', options));
	return code(res.data.code, res, isShow)
}


// 商家端 现金券 删除
async function deleteAVoucherApi(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`merchants/coupons/${options.id}/delete`, 'post', options));
	return code(res.data.code, res, isShow)
}

// 商家端 商品列表
async function getGoodsListApi(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`merchants/goods/list`, 'get', options));
	return code(res.data.code, res, isShow)
}
// 商家端 编辑商品分类
async function goodsCategories(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`merchants/goods-categories/${id}/edit`, 'post', options));
	return code(res.data.code, res, isShow)
}

// 商家端 管理员列表
async function getAdminListApi(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`merchants/administrators`, 'get', options));
	return code(res.data.code, res, isShow)
}

// 商家端 添加管理员
async function addAdminApi(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`merchants/administrators/add`, 'post', options));
	return code(res.data.code, res, isShow)
}

// 商家端  根据手机号搜索用户
async function getUserListApi(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`merchants/administrators/search`, 'get', options));
	return code(res.data.code, res, isShow)
}

// 商家端  删除管理员
async function deleteAdminApi(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`merchants/administrators/${options.id}/delete`, 'post',
	options));
	return code(res.data.code, res, isShow)
}

// 物流订单未完成数量
async function unReceiveNum1(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`merchants/express-orders/not-completed-number`, 'get', options));
	return code(res.data.code, res, isShow)
}

// 自提订单未完成数量
async function unReceiveNum2(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`merchants/self-pick-orders/not-completed-number`, 'get', options));
	return code(res.data.code, res, isShow)
}

// 配送订单未完成数量
async function unReceiveNum3(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`merchants/delivery-orders/not-completed-number`, 'get', options));
	return code(res.data.code, res, isShow)
}

// 点餐订单未完成数量
async function unReceiveNum4(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`merchants/meal-orders/not-completed-number`, 'get', options));
	return code(res.data.code, res, isShow)
}





// 用户端 获取现金券列表
async function getBVoucherListApi(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`users/coupons`, 'get', options));
	return code(res.data.code, res, isShow)
}

// 用户端  是否为管理员
async function getIsAdminApi(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`users/is_administrator`, 'get', options));
	return code(res.data.code, res, isShow)
}

// 用户端  购买商品使用现金券
async function getGoodVoucherApi(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`goods/${id}/coupons`, 'get', options));
	return code(res.data.code, res, isShow)
}
// imID 聊天id提交
async function imid(options, id, isShow) {
	showLoading(isShow)
	if (!options) {
		options = {};
	}
	var [error, res] = await uni.request(requests(`users/im-id/change`, 'POST', options));
	return code(res.data.code, res, isShow)
}











module.exports = {
	imid, // imID 聊天id提交
	index, //首页轮播图
	index_9, //首页 经营分类
	getTwoClassListApi, //二级经营分类
	getTwoClassGoodsListApi, //二级经营分类商品列表
	login, //登陆
	getphone, //获取手机号
	user, //用户详情
	get_merchants, //获取商家信息
	SettleIn, //商家入驻
	text, //商家入驻协议
	upImage, //图片上传
	upImageList, //图片上传多数量
	money, //商家入驻费用
	money_order, //商家入驻创建订单
	money_order_pay, //商家入驻 支付订单
	money_order_notify, //商家入驻 订单支付回调
	policy, //隐私政策
	agreement, //用户协议
	agency, //代理协议
	messages, //系统消息
	unread_count, //系统消息未读数量
	messages_details, //系统消息详情
	addresses, //添加收货地址
	addresses_list, //地址列表
	defaultAddress, //修改，默认地址
	Address_change, //编辑地址
	Address_delete, //删除地址
	nearest_address, //最近地址
	avatar, //修改用户头像
	nickname, //修改昵称
	vipfees, //会员年费
	vip_benefits, //会员权益
	vip_fees_cj, //会员年费订单创建
	vip_fees_pay, //会员年费订单支付
	vip_fees_hd, //会员年费订单回调
	merchants_type, //主营分类
	merchants_class,
	merchants_class2,
	merchants_info, //用户自己商家信息
	types, //信息发布类型
	TC_news, //同城信息
	TC_news_detail, //同城信息详情
	my_city_information, //我的信息发布
	my_city_information_dalete, //我的同城信息删除
	city_information_release, //信息发布
	point_rule, //积分规则
	point_details, //积分明细
	tab_goods_categories, //主营分类商品
	mains_list, //商家列表
	goods_list, //商品列表
	goods_list_details, //商品详情
	ADD_cart, //加入购物车
	cart_list, //购物车列表
	cart_delete, //购物车删除
	service_phone, //平台客服
	cart_orders, //购物车订单创建
	cart_orders_pay, //购物车订单支付
	cart_orders_notify, //购物车支付回调
	recommend_good, //商品推荐
	default_address, //默认地址
	self_pick_list, //自提订单列表
	self_pick_list_details, //自提订单详情
	self_pick_cancel, //取消自提订单
	order_comment, //订单评价
	user_bank, //银行卡列表
	user_withdraw, //用户提现
	user_add_bank, //用户添加银行卡
	become_agent, //成为代理
	express_order_list, //物流订单列表
	express_order_delivery, //物流订单详情
	express_order_cancel, //取消物流订单
	express_order_change_address, //物流配送修改收货地址
	spec_example, //规格实例
	commission_records, //收益记录（用户）
	orders_merchants, //订单创建（直接购买）
	users_orders_confirm, //确认收货
	refund_types, //退款可选类型
	orders_refund, //退款提交
	comments_list, //评价列表
	cancel_refund, //取消申请退款
	users_delivery_orders_list, //商家配送订单列表
	merchant_pay, //商家订单支付
	merchant_pay_notify, //商家订单支付回调
	meal_orders_list, //点餐订单列表
	tables_num, //获取桌号
	user_goods_categories, //用户获取商家商品分类
	user_goods_categories_list, //用户获取商家商品分类 列表
	merchants_search, //搜索店内商品
	user_search, //搜索商品
	users_commission_records, //收益记录
	commission_infos, //收益信息
	teams, //我的团队
	change_phone, //修改手机号
	getcode, //获取验证码
	logoff, //注销
	agentsApply, //申请成为代理
	agentsApplyInfos, //申请成为代理状态
	agentsMerchants, //我的商户
	usersDirect, //我的邀请人
	merchants_settled_rule, //入驻规则
	chinaArea, //获取省市区
	chinaArea_id, //获取城市
	direct_refund, //直接退款
	cartsClear, //清空购物车

	/* 上线 */
	online, //上线
	send, //发送信息
	user_unread, //用户未读消息
	messages_unread, //商家未读消息
	is_online, //是否上线
	/* 上线 */
	userBaseInfo, //用户简略信息
	// 订单未完成数量
	unfinished1,
	unfinished2,
	unfinished3,
	unfinished4,
	// 订单未完成数量

	/* 
	商家端接口
	 */
	merchant, //商家信息
	change_lng_lat, //修改经纬度
	merchant_avater, //修改商家头像
	merchant_cover, //修改商家封面
	merchant_address, //修改商家地址
	merchant_person, //修改商家联系人
	merchant_phone, //修改商家联系电话
	merchant_intro, //修改店铺简介
	merchant_name, //修改店铺名
	merchant_cate_add, //商家添加商品分类
	merchant_cate_edit, //商家修改分类
	merchant_cate_delete, //商家分类删除
	merchant_cate_list, //商家主营分类列表
	goods_categories, //商家商品分类列表
	merchant_goods_list, //商家消息列表
	merchant_good_list, //商家端商品列表
	merchant_goods_delete, //商家删除商品
	merchant_goods_add, //商家新建商品
	merchant_goods_edit, //商品编辑
	merchant_open, //店铺营业开启
	merchant_close, //店铺营业关闭
	merchant_Time, //店铺营业时间
	add_bank, //添加银行卡
	my_bank, //我的银行卡
	withdraw, //商家提现
	my_bank_delete, //删除银行卡
	change_yunfei, //修改运费
	write_off, //商家自提订单核销
	tables_add, //添加桌号
	tables_list, //桌号列表
	tables_change, //修改桌号
	order_tz, //订单通知
	merchants_self_pick_list, //自提订单列表
	merchants_self_pick_details, //自提订单详情
	express_orders_list, //物流订单列表
	merchants_meal_orders_list, //点餐订单列表
	delivery_orders_list, //配送订单列表
	orders_details, //订单详情
	merchants_goods_delete, //删除商品
	express_delivery_orders, //填写运单号
	credit_records, //收益明细
	efund_orders, //拒绝退款
	efund_orders_agree, //同意退款
	delivery_orders_cancel, //取消配送订单
	delivery_orders_take, //接单
	delivery_orders_confirm, //确认送达
	meal_orders, //处理点餐订单
	month_transaction_details, //月报
	change_shop_printer, //打印设置
	merchants_change_shop_point, //积分开通申请
	merchants_order_messages_read, //订单消息已读
	merchants_order_messages_unread_number, //订单消息未读数量
	getAVoucherListApi, //商家端 获取现金券列表
	addAVoucherApi, //商家端 添加代金券
	updateAVoucherApi,//商家端 修改代金券
	deleteAVoucherApi, //商家端  现金券删除
	getGoodsListApi, //商家端 商品列表
	getAdminListApi, //商家端  管理员列表
	addAdminApi, //商家端  添加管理员
	deleteAdminApi, //商家端 删除管理员
	getUserListApi, //商家端  根据手机号搜索用户
	getBVoucherListApi, //用户端 现金券列表
	getIsAdminApi, //用户端 是否管理员
	getGoodVoucherApi, //用户端  商品现金券列表
	goodsCategories,  // 商家端 编辑商品分类
	unReceiveNum1,//物流订单未完成数量
	unReceiveNum2,//自提订单未完成数量
	unReceiveNum3,//配送订单未完成数量
	unReceiveNum4,//点餐订单未完成数量
	
}
